package chapter04

/**
 * @program lu-scala01
 * @description:  多维数组(不可变数组)
 * @author: zhanglu
 * @create: 2022-03-29 17:15:00
 */
object Lu03_MulArray {

  def main(args: Array[String]): Unit = {
    val arr: Array[Array[Int]] = Array.ofDim[Int](2, 3)

    arr(0)(2) = 19
    arr(1)(0) = 20

    for(i <- 0 until arr.length; j <- 0 until arr(i).length){
      print(arr(i)(j) + " ")
    }
    println()
    for(i <- arr.indices; j <- arr(i).indices){
      print(arr(i)(j) + "\t")
      if(j == arr(i).length - 1){
        println()
      }
    }

    arr.foreach(line => line.foreach(print))
    println()
    arr.foreach(_.foreach(print))

  }

}
